package leihua.crm.workbench.service.impl;

import leihua.crm.workbench.domain.Customer;
import leihua.crm.workbench.mapper.CustomerMapper;
import leihua.crm.workbench.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author leiHua
 * @Date 2022/10/25 13:00
 */
@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    CustomerMapper customerMapper;
    @Override
    public List<String> queryCustomerNameByCustomerName(String customerName) {
        return customerMapper.selectCustomerNameByCustomerName(customerName);
    }

    @Override
    public List<Customer> queryCustomerForPageByCondition(Map<String, Object> map) {
        return customerMapper.selectCustomerForPageByCondition(map);
    }

    @Override
    public int queryCountOfCustomerForPageByCondition(Map<String, Object> map) {
        return customerMapper.selectCountOfCustomerForPageByCondition(map);
    }

    @Override
    public Customer queryCustomerByName(String name) {
        return customerMapper.selectCustomerByName(name);
    }

    @Override
    public Customer queryCustomerForDetailByCustomerId(String customerId) {
        return customerMapper.selectCustomerForDetailByCustomerId(customerId);
    }

    @Override
    public int saveCreateCustomer(Customer customer) {
        return customerMapper.insertSelective(customer);
    }

    @Override
    public int editCustomer(Customer customer) {
        return customerMapper.updateByPrimaryKeySelective(customer);
    }

    @Override
    public Customer queryCustomerByPrimaryKey(String customerId) {
        return customerMapper.selectByPrimaryKey(customerId);
    }

    @Override
    public int deleteCustomerByIds(String[] ids) {
        return customerMapper.deleteCustomerByIds(ids);
    }
}
